1 /* 2 * Copyright (c) 2011-2014 - Mauro Carvalho Chehab 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License as published by 6 * the Free Software Foundation version 2.1 of the License. 7 * 8 * This program is distributed in the hope that it will be useful, 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * GNU Lesser General Public License for more details. 12 * 13 * You should have received a copy of the GNU Lesser General Public License 14 * along with this program; if not, write to the Free Software 15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 16 * Or, point your browser to http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 17 * 18 */ 19 20 module libdvbv5_d.dvb_fe; 21 22 import libdvbv5_d.dvb_v5_std: DTV_NUM_STATS_PROPS, 23 dvb_quality; 24 import libdvbv5_d.dvb_frontend: DTV_STAT_SIGNAL_STRENGTH, DTV_STAT_CNR, DTV_STAT_ERROR_BLOCK_COUNT, 25 dvb_frontend_info, fe_delivery_system_t, dtv_stats, fecap_scale_params, fe_sec_tone_mode_t; 26 import libdvbv5_d.dvb_log: dvb_logfunc; 27 import libdvbv5_d.dvb_sat: dvb_sat_lnb; 28 29 extern (C): 30 31 /** 32 * @file dvb-fe.h 33 * @ingroup frontend 34 * @brief Provides interfaces to deal with DVB frontend. 35 * @copyright GNU Lesser General Public License version 2.1 (LGPLv2.1) 36 * @author Mauro Carvalho Chehab 37 * 38 * The libdvbv5 API works with a set of key/value properties. 39 * There are two types of properties: 40 * 41 * - The ones defined at the Kernel's frontent API, that are found at 42 * /usr/include/linux/dvb/frontend.h (actually, it uses a local copy 43 * of that file, stored at ./include/linux/dvb/frontend.h) 44 * 45 * - Some extra properties used by libdvbv5. Those can be found at 46 * lib/include/libdvbv5/dvb-v5-std.h and start at DTV_USER_COMMAND_START. 47 * 48 * Just like the DTV properties, the stats are cached. That warrants that 49 * all stats are got at the same time, when dvb_fe_get_stats() is called. 50 * 51 * @par Bug Report 52 * Please submit bug reports and patches to linux-media@vger.kernel.org 53 */ 54 55 /** 56 * @def ARRAY_SIZE(array) 57 * @brief Calculates the number of elements of an array 58 * @ingroup ancillary 59 */ 60 extern (D) size_t ARRAY_SIZE(T)(auto ref T x) 61 { 62 return x.sizeof / (x[0]).sizeof; 63 } 64 65 /** 66 * @def MAX_DELIVERY_SYSTEMS 67 * @brief Max number of delivery systems for a given frontend. 68 * @ingroup frontend 69 */ 70 enum MAX_DELIVERY_SYSTEMS = 20; 71 72 /* 73 * There are a few aliases for other properties. Those are needed just 74 * to avoid breaking apps that depend on the library but shoudn't be used 75 * anymore on newer apps. 76 */ 77 enum DTV_MAX_STATS = DTV_NUM_STATS_PROPS; 78 enum DTV_SIGNAL_STRENGTH = DTV_STAT_SIGNAL_STRENGTH; 79 enum DTV_SNR = DTV_STAT_CNR; 80 enum DTV_UNCORRECTED_BLOCKS = DTV_STAT_ERROR_BLOCK_COUNT; 81 82 /** 83 * @struct dvb_v5_fe_parms 84 * @ingroup frontend 85 * @brief Keeps data needed to handle the DVB frontend 86 * 87 * @param info Contains the DVB info properties (RO) 88 * @param version Version of the Linux DVB API (RO) 89 * @param has_v5_stats A value different than 0 indicates that the 90 * frontend supports DVBv5 stats (RO) 91 * @param current_sys Currently selected delivery system (RO) 92 * @param num_systems Number of delivery systems (RO) 93 * @param systems Delivery systems supported by the hardware (RO) 94 * @param legacy_fe A value different than 0 indicates a legacy 95 * Kernel driver using DVBv3 API only, or that 96 * DVBv3 only mode was forced by the client (RO) 97 * @param abort Client should set it to abort a pending 98 * operation like DTV scan (RW) 99 * @param lna: Sets the LNA mode 0 disables; 1 enables, -1 uses 100 * auto mode (RW) 101 * @param lnb LNBf description (RW) 102 * @param sat_number Number of the satellite (used by DISEqC setup) (RW) 103 * @param freq_bpf SCR/Unicable band-pass filter frequency to use, in kHz 104 * @param verbose Verbosity level of the library (RW) 105 * @param dvb_logfunc Function used to write log messages (RO) 106 * @param default_charset Name of the charset used by the DVB standard (RW) 107 * @param output_charset Name of the charset to output (system specific) (RW) 108 * 109 * @details The fields marked as RO should not be changed by the client, as otherwise 110 * undesired effects may happen. The ones marked as RW are ok to either read 111 * or write by the client. 112 */ 113 struct dvb_v5_fe_parms 114 { 115 /* Information visible to the client - don't override those values */ 116 dvb_frontend_info info; 117 uint version_; 118 int has_v5_stats; 119 fe_delivery_system_t current_sys; 120 int num_systems; 121 fe_delivery_system_t[MAX_DELIVERY_SYSTEMS] systems; 122 int legacy_fe; 123 124 /* The values below are specified by the library client */ 125 126 /* Flags from the client to the library */ 127 int abort; 128 129 /* Linear Amplifier settings */ 130 int lna; 131 132 /* Satellite settings */ 133 const(dvb_sat_lnb)* lnb; 134 int sat_number; 135 uint freq_bpf; 136 uint diseqc_wait; 137 138 /* Function to write DVB logs */ 139 uint verbose; 140 dvb_logfunc logfunc; 141 142 /* Charsets to be used by the conversion utilities */ 143 char* default_charset; 144 char* output_charset; 145 } 146 147 /** 148 * @brief Allocates a dummy frontend structure 149 * @ingroup frontend 150 * 151 * @details This is useful for some applications that may want to just use the 152 * frontend structure internally, without associating it with a real hardware 153 * 154 * @return Returns a pointer to a dummy struct, or NULL if no memory. 155 */ 156 dvb_v5_fe_parms* dvb_fe_dummy (); 157 158 /** 159 * @brief Opens a frontend and allocates a structure to work with 160 * @ingroup frontend 161 * 162 * @param adapter Number of the adapter to open 163 * @param frontend Number of the frontend to open 164 * @param verbose Verbosity level of the messages that will be 165 * printed 166 * @param use_legacy_call Force to use the DVBv3 calls, instead of using 167 * the DVBv5 API 168 * @param logfunc Callback function to be called when a log event 169 * happens. Can either store the event into a file 170 * or to print it at the TUI/GUI. If NULL, the 171 * library will use its internal handler. 172 * @param flags Flags to be passed to open. Currently only two 173 * flags are supported: O_RDONLY or O_RDWR. 174 * Using O_NONBLOCK may hit unexpected issues. 175 * 176 * @todo Add/check support for O_NONBLOCK at the scan routines. 177 * 178 * @details This function should be called before using any other function at 179 * the frontend library (or the other alternatives: dvb_fe_open() or 180 * dvb_fe_dummy(). 181 * 182 * In general, this is called using O_RDWR, except if all that it is wanted 183 * is to check the DVB frontend statistics. 184 * 185 * @return Returns a pointer to an allocated data pointer or NULL on error. 186 */ 187 dvb_v5_fe_parms* dvb_fe_open_flags ( 188 int adapter, 189 int frontend, 190 uint verbose, 191 uint use_legacy_call, 192 dvb_logfunc logfunc, 193 int flags); 194 195 /** 196 * @brief Opens a frontend and allocates a structure to work with 197 * @ingroup frontend 198 * 199 * @param adapter Number of the adapter to open 200 * @param frontend Number of the frontend to open 201 * @param verbose Verbosity level of the messages that will be 202 * printed 203 * @param use_legacy_call Force to use the DVBv3 calls, instead of using 204 * the DVBv5 API 205 * 206 * @details This function should be called before using any other function at 207 * the frontend library (or the other alternatives: dvb_fe_open2() or 208 * dvb_fe_dummy(). 209 * 210 * @return Returns a pointer to an allocated data pointer or NULL on error. 211 */ 212 dvb_v5_fe_parms* dvb_fe_open ( 213 int adapter, 214 int frontend, 215 uint verbose, 216 uint use_legacy_call); 217 218 /** 219 * @brief Opens a frontend and allocates a structure to work with 220 * @ingroup frontend 221 * 222 * @param adapter Number of the adapter to open 223 * @param frontend Number of the frontend to open 224 * @param verbose Verbosity level of the messages that will be 225 * printed 226 * @param use_legacy_call Force to use the DVBv3 calls, instead of using 227 * the DVBv5 API 228 * @param logfunc Callback function to be called when a log event 229 * happens. Can either store the event into a file 230 * or to print it at the TUI/GUI. 231 * 232 * @details This function should be called before using any other function at 233 * the frontend library (or the other alternatives: dvb_fe_open() or 234 * dvb_fe_dummy(). 235 * 236 * @return Returns a pointer to an allocated data pointer or NULL on error. 237 */ 238 dvb_v5_fe_parms* dvb_fe_open2 ( 239 int adapter, 240 int frontend, 241 uint verbose, 242 uint use_legacy_call, 243 dvb_logfunc logfunc); 244 245 /** 246 * @brief Closes the frontend and frees allocated resources 247 * @ingroup frontend 248 * 249 * @param parms struct dvb_v5_fe_parms pointer to the opened device 250 */ 251 void dvb_fe_close (dvb_v5_fe_parms* parms); 252 253 /** 254 * @brief Returns the string name associated with a DVBv5 command 255 * @ingroup frontend 256 * 257 * @param cmd DVBv5 or libdvbv5 property 258 * 259 * @details This function gets an integer argument (cmd) and returns a string 260 * that corresponds to the name of that property. 261 * 262 * @return it returns a string that corresponds to the property name. 263 * For example: 264 * dvb_cmd_name(DTV_GUARD_INTERVAL) would return "GUARD_INTERVAL" 265 * It also returns names for the properties used internally by libdvbv5. 266 */ 267 const(char)* dvb_cmd_name (int cmd); 268 269 /** 270 * @brief Returns an string array with the valid string values associated with a DVBv5 command 271 * @ingroup frontend 272 * 273 * @param cmd DVBv5 or libdvbv5 property 274 * 275 * @return it returns a string array that corresponds to the names associated 276 * with the possible values for that property, when available. 277 * For example: 278 * dvb_cmd_name(DTV_CODE_RATE_HP) would return an array with the 279 * possible values for the code rates: 280 * { "1/2", "2/3", ... NULL } 281 * @note The array always ends with NULL. 282 */ 283 const(char*)* dvb_attr_names (int cmd); 284 285 /* Get/set delivery system parameters */ 286 287 /** 288 * @brief Retrieves the value of a DVBv5/libdvbv5 property 289 * @ingroup frontend 290 * 291 * @param parms struct dvb_v5_fe_parms pointer to the opened device 292 * @param cmd DVBv5 or libdvbv5 property 293 * @param value Pointer to an uint32_t where the value will be stored. 294 * 295 * This reads the value of a property stored at the cache. Before using it, 296 * a dvb_fe_get_parms() is likely required. 297 * 298 * @return Return 0 if success, EINVAL otherwise. 299 */ 300 int dvb_fe_retrieve_parm (const(dvb_v5_fe_parms)* parms, uint cmd, uint* value); 301 302 /** 303 * @brief Stores the value of a DVBv5/libdvbv5 property 304 * @ingroup frontend 305 * 306 * @param parms struct dvb_v5_fe_parms pointer to the opened device 307 * @param cmd DVBv5 or libdvbv5 property 308 * @param value Pointer to an uint32_t where the value will be stored. 309 * 310 * This stores the value of a property at the cache. The value will only 311 * be send to the hardware after calling dvb_fe_set_parms(). 312 * 313 * @return Return 0 if success, EINVAL otherwise. 314 */ 315 int dvb_fe_store_parm (dvb_v5_fe_parms* parms, uint cmd, uint value); 316 317 /** 318 * @brief Sets the delivery system 319 * @ingroup frontend 320 * 321 * @param parms struct dvb_v5_fe_parms pointer to the opened device 322 * @param sys delivery system to be selected 323 * 324 * This function changes the delivery system of the frontend. By default, 325 * the libdvbv5 will use the first available delivery system. If another 326 * delivery system is desirable, this function should be called before being 327 * able to store the properties for the new delivery system via 328 * dvb_fe_store_parm(). 329 * 330 * @return Return 0 if success, EINVAL otherwise. 331 */ 332 int dvb_set_sys (dvb_v5_fe_parms* parms, fe_delivery_system_t sys); 333 334 /** 335 * @brief Make dvb properties reflect the current standard 336 * @ingroup frontend 337 * 338 * @param parms struct dvb_v5_fe_parms pointer to the opened device 339 * @param sys delivery system to be selected 340 * 341 * This function prepares the properties cache for a given delivery system. 342 * 343 * It is automatically called by dvb_set_sys(), and should not be normally 344 * called, except when dvb_fe_dummy() is used. 345 * 346 * @return Return 0 if success, EINVAL otherwise. 347 */ 348 int dvb_add_parms_for_sys (dvb_v5_fe_parms* parms, fe_delivery_system_t sys); 349 350 /** 351 * @brief Sets the delivery system 352 * @ingroup frontend 353 * 354 * @param parms struct dvb_v5_fe_parms pointer to the opened 355 * device 356 * @param desired_system delivery system to be selected 357 * 358 * This function changes the delivery system of the frontend. By default, 359 * the libdvbv5 will use the first available delivery system. If another 360 * delivery system is desirable, this function should be called before being 361 * able to store the properties for the new delivery system via 362 * dvb_fe_store_parm(). 363 * 364 * This function is an enhanced version of dvb_set_sys(). It has an special 365 * logic inside to work with Kernels that supports only DVBv3. 366 * 367 * @return Return 0 if success, EINVAL otherwise. 368 */ 369 int dvb_set_compat_delivery_system ( 370 dvb_v5_fe_parms* parms, 371 uint desired_system); 372 373 /** 374 * @brief Prints all the properties at the cache 375 * @ingroup frontend 376 * 377 * @param parms struct dvb_v5_fe_parms pointer to the opened device 378 * 379 * Used mostly for debugging issues. 380 */ 381 void dvb_fe_prt_parms (const(dvb_v5_fe_parms)* parms); 382 383 /** 384 * @brief Prints all the properties at the cache 385 * @ingroup frontend 386 * 387 * @param parms struct dvb_v5_fe_parms pointer to the opened device 388 * 389 * Writes the properties stored at the DVB cache at the DVB hardware. At 390 * return, some properties could have a different value, as the frontend 391 * may not support the values set. 392 * 393 * @return Return 0 if success, EINVAL otherwise. 394 */ 395 int dvb_fe_set_parms (dvb_v5_fe_parms* parms); 396 397 /** 398 * @brief Prints all the properties at the cache 399 * @ingroup frontend 400 * 401 * @param parms struct dvb_v5_fe_parms pointer to the opened device 402 * 403 * Gets the properties from the DVB hardware. The values will only reflect 404 * what's set at the hardware if the frontend is locked. 405 * 406 * @return Return 0 if success, EINVAL otherwise. 407 */ 408 int dvb_fe_get_parms (dvb_v5_fe_parms* parms); 409 410 /* 411 * statistics functions 412 */ 413 414 /** 415 * @brief Retrieve the stats for a DTV layer from cache 416 * @ingroup frontend 417 * 418 * @param parms struct dvb_v5_fe_parms pointer to the opened device 419 * @param cmd DVBv5 or libdvbv5 property 420 * @param layer DTV layer 421 * 422 * Gets the value for one stats cache, on a given layer. Layer 0 is 423 * always present. On DTV standards that doesn't have layers, it returns 424 * the same value as dvb_fe_retrieve_stats() for layer = 0. 425 * 426 * For DTV standards with multiple layers, like ISDB, layer=1 is layer 'A', 427 * layer=2 is layer 'B' and layer=3 is layer 'C'. Please notice that not all 428 * frontends support per-layer stats. Also, the layer value is only valid if 429 * the layer exists at the original stream. 430 * Also, on such standards, layer 0 is typically a mean value of the layers, 431 * or a sum of events (if FE_SCALE_COUNTER). 432 * 433 * For it to be valid, dvb_fe_get_stats() should be called first. 434 * 435 * @return It returns a struct dtv_stats if succeed or NULL otherwise. 436 */ 437 dtv_stats* dvb_fe_retrieve_stats_layer ( 438 dvb_v5_fe_parms* parms, 439 uint cmd, 440 uint layer); 441 442 /** 443 * @brief Retrieve the stats for a DTV layer from cache 444 * @ingroup frontend 445 * 446 * @param parms struct dvb_v5_fe_parms pointer to the opened device 447 * @param cmd DVBv5 or libdvbv5 property 448 * @param value DTV value pointer 449 * 450 * Gets the value for one stats property for layer = 0. 451 * 452 * For it to be valid, dvb_fe_get_stats() should be called first. 453 * 454 * @return The returned value is 0 if success, EINVAL otherwise. 455 */ 456 int dvb_fe_retrieve_stats (dvb_v5_fe_parms* parms, uint cmd, uint* value); 457 458 /** 459 * @brief Retrieve the stats from the Kernel 460 * @ingroup frontend 461 * 462 * @param parms struct dvb_v5_fe_parms pointer to the opened device 463 * 464 * Updates the stats cache from the available stats at the Kernel. 465 * 466 * @return The returned value is 0 if success, EINVAL otherwise. 467 */ 468 int dvb_fe_get_stats (dvb_v5_fe_parms* parms); 469 470 /** 471 * @brief Retrieve the BER stats from cache 472 * @ingroup frontend 473 * 474 * @param parms struct dvb_v5_fe_parms pointer to the opened device 475 * @param layer DTV layer 476 * @param scale retrieves the scale 477 * 478 * Gets the value for BER stats from stats cache, on a given layer. Layer 0 is 479 * always present. On DTV standards that doesn't have layers, it returns 480 * the same value as dvb_fe_retrieve_stats() for layer = 0. 481 * 482 * For DTV standards with multiple layers, like ISDB, layer=1 is layer 'A', 483 * layer=2 is layer 'B' and layer=3 is layer 'C'. Please notice that not all 484 * frontends support per-layer stats. Also, the layer value is only valid if 485 * the layer exists at the original stream. 486 * Also, on such standards, layer 0 is typically a mean value of the layers, 487 * or a sum of events (if FE_SCALE_COUNTER). 488 * 489 * For it to be valid, dvb_fe_get_stats() should be called first. 490 * 491 * @return It returns a float number for the BER value. 492 * If the statistics is not available for any reason, scale will be equal to 493 * FE_SCALE_NOT_AVAILABLE. 494 */ 495 float dvb_fe_retrieve_ber ( 496 dvb_v5_fe_parms* parms, 497 uint layer, 498 fecap_scale_params* scale); 499 500 /** 501 * @brief Retrieve the PER stats from cache 502 * @ingroup frontend 503 * 504 * @param parms struct dvb_v5_fe_parms pointer to the opened device 505 * @param layer DTV layer 506 * 507 * Gets the value for BER stats from stats cache, on a given layer. Layer 0 is 508 * always present. On DTV standards that doesn't have layers, it returns 509 * the same value as dvb_fe_retrieve_stats() for layer = 0. 510 * 511 * For DTV standards with multiple layers, like ISDB, layer=1 is layer 'A', 512 * layer=2 is layer 'B' and layer=3 is layer 'C'. Please notice that not all 513 * frontends support per-layer stats. Also, the layer value is only valid if 514 * the layer exists at the original stream. 515 * Also, on such standards, layer 0 is typically a mean value of the layers, 516 * or a sum of events (if FE_SCALE_COUNTER). 517 * 518 * For it to be valid, dvb_fe_get_stats() should be called first. 519 * 520 * @return A negative value indicates error. 521 */ 522 float dvb_fe_retrieve_per (dvb_v5_fe_parms* parms, uint layer); 523 524 /** 525 * @brief Retrieve the quality stats from cache 526 * @ingroup frontend 527 * 528 * @param parms struct dvb_v5_fe_parms pointer to the opened device 529 * @param layer DTV layer 530 * 531 * Gets a quality measure for a given layer. Layer 0 is 532 * always present. On DTV standards that doesn't have layers, it returns 533 * the same value as dvb_fe_retrieve_stats() for layer = 0. 534 * 535 * For DTV standards with multiple layers, like ISDB, layer=1 is layer 'A', 536 * layer=2 is layer 'B' and layer=3 is layer 'C'. Please notice that not all 537 * frontends support per-layer stats. Also, the layer value is only valid if 538 * the layer exists at the original stream. 539 * Also, on such standards, layer 0 is typically a mean value of the layers, 540 * or a sum of events (if FE_SCALE_COUNTER). 541 * 542 * For it to be valid, dvb_fe_get_stats() should be called first. 543 * 544 * @return returns an enum dvb_quantity, where DVB_QUAL_UNKNOWN means that 545 * the stat isnot available. 546 */ 547 dvb_quality dvb_fe_retrieve_quality (dvb_v5_fe_parms* parms, uint layer); 548 549 /** 550 * @brief Ancillary function to sprintf on ENG format 551 * @ingroup frontend 552 * 553 * @param buf buffer to store the value 554 * @param len buffer length 555 * @param val value to be printed 556 * 557 * On ENG notation, the exponential value should be multiple of 3. This is 558 * good to display some values, like BER. 559 * 560 * @return At return, it shows the actual size of the print. A negative value 561 * indicates an error. 562 */ 563 int dvb_fe_snprintf_eng (char* buf, int len, float val); 564 565 /** 566 * @brief Ancillary function to sprintf on ENG format 567 * @ingroup frontend 568 * 569 * @param parms struct dvb_v5_fe_parms pointer to the opened device 570 * @param cmd DVBv5 or libdvbv5 property 571 * @param display_name String with the name of the property to be shown 572 * @param layer DTV Layer 573 * @param buf buffer to store the value 574 * @param len buffer length 575 * @param show_layer_name a value different than zero shows the layer name, if 576 * the layer is bigger than zero. 577 * 578 * This function calls internally dvb_fe_retrieve_stats_layer(). It allows to 579 * print a DVBv5 statistics value into a string. An extra property is available 580 * (DTV_QUALITY) with prints either one of the values: Poor, Ok or Good, 581 * depending on the overall measures. 582 * 583 * @return: It returns the length of the printed data. A negative value 584 * indicates an error. 585 */ 586 int dvb_fe_snprintf_stat ( 587 dvb_v5_fe_parms* parms, 588 uint cmd, 589 char* display_name, 590 int layer, 591 char** buf, 592 int* len, 593 int* show_layer_name); 594 595 /** 596 * @brief Get both status statistics and dvb parameters 597 * @ingroup frontend 598 * 599 * @param parms struct dvb_v5_fe_parms pointer to the opened device 600 * 601 * That's similar of calling both dvb_fe_get_parms() and dvb_fe_get_stats(). 602 * 603 * @return It returns 0 if success or an errorno otherwise. 604 */ 605 int dvb_fe_get_event (dvb_v5_fe_parms* parms); 606 607 /* 608 * Other functions, associated to SEC/LNB/DISEqC 609 * 610 * The functions below are just wrappers for the Kernel calls, in order to 611 * manually control satellite systems. 612 * 613 * Instead of using most them, the best is to set the LNBf parameters, and let 614 * the libdvbv5 to automatically handle the calls. 615 * 616 * NOTE: It currently lacks support for two ioctl's: 617 * FE_DISEQC_RESET_OVERLOAD used only on av7110. 618 * Spec says: 619 * If the bus has been automatically powered off due to power overload, 620 * this ioctl call restores the power to the bus. The call requires read/write 621 * access to the device. This call has no effect if the device is manually 622 * powered off. Not all DVB adapters support this ioctl. 623 * 624 * FE_DISHNETWORK_SEND_LEGACY_CMD is used on av7110, budget, gp8psk and stv0299 625 * Spec says: 626 * WARNING: This is a very obscure legacy command, used only at stv0299 627 * driver. Should not be used on newer drivers. 628 * It provides a non-standard method for selecting Diseqc voltage on the 629 * frontend, for Dish Network legacy switches. 630 * As support for this ioctl were added in 2004, this means that such dishes 631 * were already legacy in 2004. 632 * 633 * So, it doesn't make much sense on implementing support for them. 634 */ 635 636 /** 637 * @brief DVB ioctl wrapper for setting SEC voltage 638 * @ingroup frontend 639 * 640 * @param parms struct dvb_v5_fe_parms pointer to the opened device 641 * @param on a value different than zero indicates to enable 642 * voltage on a Satellite Equipment Control (SEC) 643 * @param v18 if on != 0, a value different than zero means 18 Volts; 644 * zero means 13 Volts. 645 * 646 * If dvb_v5_fe_parms::lnb is set, this is controlled automatically. 647 */ 648 int dvb_fe_sec_voltage (dvb_v5_fe_parms* parms, int on, int v18); 649 650 /** 651 * @brief DVB ioctl wrapper for setting SEC tone 652 * @ingroup frontend 653 * 654 * @param parms struct dvb_v5_fe_parms pointer to the opened device 655 * @param tone tone setting, as defined by DVB fe_sec_tone_mode_t type 656 * 657 * If dvb_v5_fe_parms::lnb is set, this is controlled automatically. 658 */ 659 int dvb_fe_sec_tone (dvb_v5_fe_parms* parms, fe_sec_tone_mode_t tone); 660 661 /** 662 * @brief DVB ioctl wrapper for setting LNBf high voltage 663 * @ingroup frontend 664 * 665 * @param parms struct dvb_v5_fe_parms pointer to the opened device 666 * @param on a value different than zero indicates to produce 667 * lightly higher voltages instead of 13/18V, in order 668 * to compensate for long cables. 669 */ 670 int dvb_fe_lnb_high_voltage (dvb_v5_fe_parms* parms, int on); 671 672 /** 673 * @brief DVB ioctl wrapper for setting SEC DiSeqC tone burst to select between 674 * satellite A or B 675 * @ingroup frontend 676 * 677 * @param parms struct dvb_v5_fe_parms pointer to the opened device 678 * @param mini_b if different than zero, sends a 22 KHz tone burst to 679 * select satellite B. Otherwise, sends tone to select 680 * satellite A. 681 * 682 * Valid only on certain DISEqC arrangements. 683 * 684 * If dvb_v5_fe_parms::lnb is set, this is controlled automatically. 685 */ 686 int dvb_fe_diseqc_burst (dvb_v5_fe_parms* parms, int mini_b); 687 688 /** 689 * @brief DVB ioctl wrapper for setting SEC DiSeqC command 690 * @ingroup frontend 691 * 692 * @param parms struct dvb_v5_fe_parms pointer to the opened device 693 * @param len size of the DiSEqC command 694 * @param buf DiSEqC command to be sent 695 * 696 * If dvb_v5_fe_parms::lnb is set, this is controlled automatically. 697 */ 698 int dvb_fe_diseqc_cmd ( 699 dvb_v5_fe_parms* parms, 700 const uint len, 701 const(ubyte)* buf); 702 703 /** 704 * @brief DVB ioctl wrapper for getting SEC DiSEqC reply 705 * @ingroup frontend 706 * 707 * @param parms struct dvb_v5_fe_parms pointer to the opened device 708 * @param len size of the DiSEqC command 709 * @param buf DiSEqC command to be sent 710 * @param timeout maximum time to receive the command, in ms. 711 * 712 * If dvb_v5_fe_parms::lnb is set, this is controlled automatically. 713 */ 714 int dvb_fe_diseqc_reply ( 715 dvb_v5_fe_parms* parms, 716 uint* len, 717 char* buf, 718 int timeout); 719 720 /** 721 * @brief DVB Ancillary routine to check if a given Delivery system is satellite 722 * @ingroup frontend 723 * 724 * @param delivery_system delivery system to be selected 725 */ 726 int dvb_fe_is_satellite (uint delivery_system); 727 728 /** 729 * @brief Set default country variant of delivery systems like ISDB-T 730 * @ingroup frontend 731 * 732 * @param parms struct dvb_v5_fe_parms pointer to the opened device 733 * @param country default country, in ISO 3166-1 two letter code. If 734 * NULL, default charset is guessed from locale environment 735 * variables. 736 * 737 * @return 0 if success or an errorno otherwise. 738 * 739 * "COUNTRY" property in dvb_fe_set_parm() overrides the setting. 740 */ 741 int dvb_fe_set_default_country (dvb_v5_fe_parms* parms, const(char)* country); 742 743 /* 744 * Arrays from dvb-v5.h 745 * 746 * Those arrays can be used to translate from a DVB property into a name. 747 * 748 * No need to directly access them from userspace, as dvb_attr_names() 749 * already handles them into a more standard way. 750 */ 751 752 extern __gshared const(uint)[8] fe_bandwidth_name; 753 extern __gshared const(char)*[72] dvb_v5_name; 754 extern __gshared const(void)*[] dvb_v5_attr_names; 755 extern __gshared const(char)*[20] delivery_system_name; 756 extern __gshared const(char)*[14] fe_code_rate_name; 757 extern __gshared const(char)*[15] fe_modulation_name; 758 extern __gshared const(char)*[10] fe_transmission_mode_name; 759 extern __gshared const(char)*[12] fe_guard_interval_name; 760 extern __gshared const(char)*[6] fe_hierarchy_name; 761 extern __gshared const(char)*[4] fe_voltage_name; 762 extern __gshared const(char)*[3] fe_tone_name; 763 extern __gshared const(char)*[4] fe_inversion_name; 764 extern __gshared const(char)*[4] fe_pilot_name; 765 extern __gshared const(char)*[5] fe_rolloff_name; 766